package com.assets.room.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.assets.room.entity.Check;

import java.util.List;

@Dao
public interface CheckDao {

    @Insert
    void insertCheck(Check check);

    @Insert
    void insertCheck(List<Check> check);

    @Query("UPDATE asset_check SET status = :status WHERE check_id = :check_id")
    void updateStatus(String status, String check_id);

    @Query("DELETE FROM asset_check")
    void deleteAllData();

    @Query("select * from asset_check")
    List<Check> getAllCheck();

    @Query("select * from asset_check WHERE check_id = :check_id")
    Check getAllChecks(String check_id);



    @Query("select * from asset_check WHERE is_flag = :is_flag")
    List<Check> getCheckById(String is_flag);

    @Query("SELECT submit_time FROM asset_check WHERE check_id = :check_id")
    String getSubmitTime(String check_id);

    @Query("SELECT status FROM asset_check WHERE check_id = :check_id")
    String getStatusByCheckId(String check_id);

    @Query("UPDATE asset_check set submit_time = :submit_time, is_flag = :is_flag WHERE check_id = :check_id")
    void updateSubmitTime(String submit_time, String is_flag, String check_id);



}
